#ifndef _CFOLDERDATA_H_
#define _CFOLDERDATA_H_

class CFolderData;

typedef intrusive_ptr<CFolderData> PFolderData;

class CFolderData : public UShared
{
protected:
    CFolderData(const CURL &pURL);
    virtual ~CFolderData();
    
    void Load();
    void Save();

public:

    void GetValue(const std::string &pName,const std::string &pKey,UValue &pValue);
    void SetValue(const std::string &pName,const std::string &pKey,const UValue &pValue);
    void GetAllValues(dbus::CReply*,const std::string &pKey);
    void GetPairs(dbus::CReply*,const std::string &pName);
    void GetAllPairs(dbus::CReply*);

    CFileData *GetFileData(const std::string &pName,bool pCreate);

    static PFolderData GetFolder(const CURL &pURL);

private:
    CURL mFolder;
    std::string mDataFileName;

    std::unordered_map<std::string,CFileData*> mFiles;

    static std::unordered_map<std::string,CFolderData*> mAll;
};

#endif
